<template>
	<view class="container">
		<view class="topline">
		</view>
		<view class="warp u-m-t-20">
			<view class="count u-p-t-36 u-p-b-10 u-flex u-row-center">
				<u-count-to class="count-to" ref="uCountTo" :autoplay="autoplay" :startVal="startVal" :endVal="endVal" :duration="duration"
				 :decimals="decimals" :bold="bold" :fontSize="fontSize" :color="color"></u-count-to>
				<text class="u-m-l-10">名优秀伙伴为您服务</text>
			</view>

			<u-form :model="model" :rules="rules" ref="uForm" :errorType="errorType">
				<u-form-item class="group" :required="required" :label-width="200" :border-bottom="false" :label-position="labelPosition"
				 label="我是" prop="ws">
					<u-input :border="border" type="select" :select-open="selectShowWs" v-model="model.ws" placeholder="请选择"
					 placeholderStyle="color: #4B9CFF;" input-align="right" @click="selectShowWs = true"></u-input>
				</u-form-item>
				<u-form-item class="group" :required="required" :label-width="200" :border-bottom="false" :label-position="labelPosition"
				 label="我需要" prop="wxy">
					<u-input :border="border" type="select" :select-open="selectShowWxy" v-model="model.wxy" placeholder="请选择"
					 placeholderStyle="color: #4B9CFF;" input-align="right" @click="selectShowWxy = true"></u-input>
				</u-form-item>
				<u-form-item class="group" :required="required" :label-width="200" :border-bottom="false" :label-position="labelPosition"
				 label="我意向" prop="wyx">
					<u-input :border="border" type="select" :select-open="selectShowWyx" v-model="model.wyx" placeholder="请选择"
					 placeholderStyle="color: #4B9CFF;" input-align="right" @click="selectShowWyx = true"></u-input>
				</u-form-item>



			</u-form>
		</view>
		<u-gap :bg-color="bgColor" :height="height" :margin-top="marginTop" :margin-bottom="marginBottom"></u-gap>
		<view class="u-m-l-28 u-m-t-36 kcjs u-flex">
			<image  src="../../static/img/kcjs.png" mode=""></image>
			<text class="u-font-34 u-m-l-15">课程介绍</text>
		</view>
		<view class="u-m-l-30 u-m-t-75 u-m-r-30">
			<view class="u-flex u-row-between u-border-bottom u-font-30 u-p-b-40">
				<text>课程说明</text>
				<text style="color: #9DA2B0;">关于桥梁设计规范说明</text>
			</view>
			<view class="u-flex u-row-between u-border-bottom u-m-t-40 u-font-30 u-p-b-40">
				<text>课程编号</text>
				<text style="color: #9DA2B0;">100123</text>
			</view>
			<view class="u-flex u-row-between u-border-bottom u-m-t-40 u-font-30 u-p-b-40">
				<text>课程时长</text>
				<text style="color: #9DA2B0;">20课时</text>
			</view>
			<view class="u-flex u-row-between u-border-bottom u-m-t-40 u-font-30 u-p-b-40">
				<text>授课方式</text>
				<text style="color: #9DA2B0;">线上</text>
			</view>
			<view class="u-flex u-row-between u-border-bottom u-m-t-40 u-font-30 u-p-b-40">
				<text>授课导师</text>
				<text style="color: #9DA2B0;">刘博士</text>
			</view>
			<view class="u-flex u-row-between u-border-bottom u-m-t-40 u-font-30 u-p-b-40">
				<text>课程价值</text>
				<text style="color: #FE5022;">￥1000</text>
			</view>
			<view class="u-flex u-row-between u-border-bottom u-m-t-40 u-font-30 u-p-b-40">
				<text>裂变抵扣</text>
				<text style="color: #9DA2B0;">￥50</text>
			</view>
		</view>
		<view class="warp u-m-t-20 u-p-30">

			<u-button class="button" @click="submit">马上为我匹配</u-button>
			<!--弹出框-->
			<u-select mode="single-column"  value-name="id" label-name="name"  :list="wsList" v-model="selectShowWs" @confirm="selectConfirmWs"></u-select>
			<u-select mode="single-column" :list="wxyList" v-model="selectShowWxy" @confirm="selectConfirmWxy"></u-select>
			<u-select mode="single-column" :list="wyxList" v-model="selectShowWyx" @confirm="selectConfirmWyx"></u-select>
			<u-select mode="single-column" :list="selectList" v-model="selectShowQylx" @confirm="selectConfirmQylx"></u-select>
			<u-select mode="single-column" :list="selectList" v-model="selectShowQydy" @confirm="selectConfirmQydy"></u-select>
			<u-select mode="single-column" :list="selectList" v-model="selectShowLyxy" @confirm="selectConfirmLyxy"></u-select>
			<!--弹出框-->
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			let that = this;
			return {
				height: 20,
				bgColor: this.$u.color.bgColor,
				marginTop: 30,
				marginBottom: 30,
				/**
				 * form验证
				 * */
				model: {
					ws: '',
					wxy: '',
					wyx: '',
					qymc: ''
				},
				selectList: [{
						value: '测试1',
						label: '测试1'
					},
					{
						value: '测试2',
						label: '测试2'
					},
					{
						value: '测试3',
						label: '测试3'
					}
				],
				wsList:[],
				wxyList:[],
				wyxList:[],
				rules: {
					ws: [{
						required: false,
						message: '请选择我是',
						trigger: 'change'
					}],
					wxy: [{
						required: false,
						message: '请选择我需要',
						trigger: 'change'
					}],
					wyx: [{
						required: false,
						message: '请选择我意向',
						trigger: 'change'
					}]
				},
				required: false,
				border: false,
				check: false,
				selectStatus: 'close',
				selectShowWs: false,
				selectShowWxy: false,
				selectShowWyx: false,
				selectShowQylx: false,
				selectShowQydy: false,
				selectShowLyxy: false,
				labelPosition: 'left',
				codeTips: '',
				errorType: ['toast'],
				/**/

				/**
				 * 数字统计
				 * */
				startVal: 500,
				endVal: 500,
				separator: ',',
				decimals: 0,
				duration: 2000,
				autoplay: true,
				useEasing: true,
				current: 3,
				isStop: false,
				bold: false,
				fontSize: 24,
				color: '#fff',
				/**/
				keyIndex: 0,
				keywords: [{
					name: '企业',
					selected: true
				}, {
					name: '设计师',
					selected: false
				}, {
					name: '监理',
					selected: false
				}, {
					name: '大型企业',
					selected: false
				}, {
					name: '采购',
					selected: false
				}, {
					name: '监理',
					selected: false
				}]
			};
		},
		mounted() {},
		onShow(){
			this.wsDictionary();
			this.wxyDictionary();
			this.wyxDictionary();
		},
		onReady() {
			this.$refs.uForm.setRules(this.rules);
		},
		methods: {
			submit() {
				this.$refs.uForm.validate(valid => {
					if (valid) {
						console.log('验证通过');
					} else {
						console.log('验证失败');
					}
				});
			},
			
			//查询匹配 我是  字典数据
			async wsDictionary(){
				let result = await this.$apis.fetchUserExtra({type:0});
				this.wsList = result.data;
			},
			//查询匹配 我需要  字典数据
			async wxyDictionary(){
				let reqBody = {};
				reqBody['primary'] = "招投标";
				reqBody['secondary'] = "我需要";
				let result = await this.$apis.findMatchingDictionary(reqBody);
				let list = result.data;
				for (let i = 0; i < list.length; i++) {
					let wxyValue = {};
					wxyValue['value'] = list[i].name;
					wxyValue['label'] = list[i].name;
					this.wxyList.push(wxyValue)
				}
			},
			//查询匹配 我意向  字典数据
			async wyxDictionary(){
				let reqBody = {};
				reqBody['primary'] = "招投标";
				reqBody['secondary'] = "我意向";
				let result = await this.$apis.findMatchingDictionary(reqBody);
				let list = result.data;
				for (let i = 0; i < list.length; i++) {
					let wyxValue = {};
					wyxValue['value'] = list[i].name;
					wyxValue['label'] = list[i].name;
					this.wyxList.push(wyxValue)
				}
			},
			selectKey(e) {
				this.keywords[e].selected = !this.keywords[e].selected;
			},
			// 选择
			selectConfirmWs(e) {
				this.model.ws = '';
				e.map((val, index) => {
					this.model.ws += this.model.ws == '' ? val.label : '-' + val.label;
				});
			},
			selectConfirmWxy(e) {
				this.model.wxy = '';
				e.map((val, index) => {
					this.model.wxy += this.model.wxy == '' ? val.label : '-' + val.label;
				});
			},
			selectConfirmWyx(e) {
				this.model.wyx = '';
				e.map((val, index) => {
					this.model.wyx += this.model.wyx == '' ? val.label : '-' + val.label;
				});
			},
			selectConfirmQylx(e) {
				this.model.qylx = '';
				e.map((val, index) => {
					this.model.qylx += this.model.qylx == '' ? val.label : '-' + val.label;
				});
			},
			selectConfirmQydy(e) {
				this.model.qydy = '';
				e.map((val, index) => {
					this.model.qydy += this.model.qydy == '' ? val.label : '-' + val.label;
				});
			}
		}
	};
</script>
<style scoped lang="scss">
	page {
		background: #FFFFFFFF;
	}

	.topline {
		width: 100%;
		height: 20rpx;
		background: #F5F5F9;
	}

	.warp {
		background: #fff;
	}

	.count {
		.count-to {
			font-size: 24rpx;
		}

		text {
			padding: 2rpx 12rpx;
			background: #ff9e21;
			color: #ffffff;
			font-size: 24rpx;
		}
	}

	.group {
		padding: 6rpx 21rpx;
		background: #f1f7ff;
		border-radius: 6rpx;
		margin: 30rpx 30rpx 0 30rpx;
	}

	.button {
		width: 662rpx;
		margin: 159rpx auto 63rpx auto;
		background: #ab61ff;
		border-radius: 40rpx;
		border: 0;
		color: #fff;

		font-size: 32rpx;

		&.u-hairline-border:after {
			border: 0;
		}
	}

	.word {
		font-size: 36rpx;
		color: #0d1d36;
		font-weight: bold;
	}

	.keywords {
		display: flex;
		flex-flow: wrap;

		view {
			margin: 0 20rpx 20rpx 0;
			padding: 8rpx 21rpx;
			background: #f6f6f6;
			display: flex;
			justify-content: space-between;
			align-items: center;

			text {
				display: block;
				width: 16rpx;
				height: 16rpx;
				margin-left: 19rpx;
				border: 4rpx solid #BDBDBD;
				border-radius: 8rpx;

			}

			&.selected {
				color: #4B9CFF;

				text {
					border-color: #4B9CFF;
					background-color: #4B9CFF;
				}
			}
		}
	}
	.kcjs{
		image{
			width: 36rpx; height: 33rpx;
		}
		text{
			color: #0D1D36;
			font-weight: bold;
		}
	}
</style>
